#! /bin/bash
SIM_OUTORD="$PWD/ss3/sim-outorder"

BENCH_MARKS[0]="perl"
BENCH_MARKS[1]="mcf"
BENCH_MARKS[2]="go"
BENCH_MARKS[3]="compress"
BENCH_MARKS[4]="gcc"

PREDICTORS[0]="mbpred"
PREDICTORS[1]="2lev"
PREDICTORS[2]="bimod"

SIZE[0]="1 1024 8 0"
SIZE[1]="1 1024 8 0"
SIZE[2]="1024"

SINGLEBRED_MODE=1
S_MODE="single"
SIM_WIDTH=8

RES_DIR="results/"
FILE_EXT=".txt"


mkdir -p results

for FSPEED in 1 2 #3 4 5 6  				# <-- indicate which Fetch speed you want to run
do
	echo "---------------------------------------------------"
	echo "Running at fetch speed $FSPEED";
	for j in 0 2 4                          # <-- indicate which Benchmarks to run
	do
		BENCH=${BENCH_MARKS[$j]}
		echo "---------------------------------------------------"
		echo "Benchmark $BENCH"
		echo "---------------------------------------------------"
		FILENAME="${BENCH}"
        for SIM_WIDTH in 8 16               # <-- Select Pipeline width
        do
        for i in 0 1 2                      # <-- indicate which Predictors to run
		do
			PRED=${PREDICTORS[$i]}
			SZ=${SIZE[$i]}
            WIDTH="-decode:width $SIM_WIDTH -issue:width $SIM_WIDTH -commit:width $SIM_WIDTH"
			echo "Running Predictor: $PRED Size: $SZ $WIDTH"
			./Run.pl -db bench.db -dir "results/${BENCH}1" -benchmark $BENCH -sim $SIM_OUTORD -args "-fastfwd 100000000 -max:inst 20000000 -bpred:$PRED $SZ -fetch:speed $FSPEED -bpred_mode $SINGLEBRED_MODE $WIDTH"  >& ${RES_DIR}${BENCH}_${PRED}_fs_${FSPEED}_w_${SIM_WIDTH}_${S_MODE}$FILE_EXT
		done
        done
	done
done
